//createWebHistory  createWebHashHistory
import { createRouter,  createWebHistory} from 'vue-router'

const routes = [
  {
    path: '/login',
    name: 'LoginView',
    component: () => import('../views/LoginView')
  },
  {
    path: '/',
    redirect: '/login', // 这里已经正确修改为重定向到登录页面
    name: 'main',
    component: () => import('../views/Main'),
    children: [
      {
        path: '/home',
        name: 'HomeView',
        component: () => import('../views/HomeView')
      },
      {
        path: '/anchorMain',
        name: 'AnchorMain',
        component: () => import('../views/AnchorMain'),
        children: [
          {
            path: '/person',
            name: 'PersonView',
            component: () => import('../views/PersonView')
          },
          {
            path: '/order',
            name: 'OrderView',
            component: () => import('../views/OrderView')
          },
        ]
      },
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

// const router = createRouter({
//   history: createWebHashHistory(),
//   routes,
// })

export default router
